package com.dzsw.test.mybatisp.controller;

import com.dzsw.test.mybatisp.entity.User;
import com.dzsw.test.mybatisp.mapper.UserExtMapper;
import com.dzsw.test.mybatisp.mapper.UserMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/mbx")
public class MybatisXController {

    @Resource
    private UserMapper userMapper;

    @Resource
    private UserExtMapper userExtMapper;

    @GetMapping("/test/select")
    public Object testSelect() {
        System.out.println(("----- selectAll method test ------"));
        List<User> userList = userMapper.selectList(null);
        for(User user:userList) {
            System.out.println(user);
        }
        User u = userMapper.selectFirst();
        System.out.println(u.getName());
        return userList;
    }
}
